home *** CD-ROM | disk | FTP | other *** search
-
- package sub_arctic.lib;
-
- import sub_arctic.output.loaded_image;
- import sub_arctic.output.drawable;
- import sub_arctic.input.pressable;
- import sub_arctic.input.move_draggable;
- import sub_arctic.input.event;
- import sub_arctic.input.user_info_holder;
- import sub_arctic.input.pick_collector;
- import sub_arctic.input.callback_object;
- import java.awt.Point;
-
- /**
- * This class provides a container for dragging that is limited to changes
- * in y only. You can put any subtree inside it to make that subtree
- * draggable. The container handles the pick process correctly so that it
- * only initiates a drag if you actually click over an object inside the an
- * object in the sub-tree (not simply anywhere inside the bounds of the
- * container). The container will "shrink-wrap" around the objects it
- * contains, and can optionally draw a bounding rectangle as drag feedback.
- *
- * @author Scott Hudson
- */
- public class vert_drag_container extends drag_container {
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Full constructor.
- *
- * @param int x initial x position of the container.
- * @param int y initial y position of the container.
- * @param boolean do_bb_feedback whether we do bounding box feedback.
- * @param callback_object cbo object to make callbacks to.
- */
- public vert_drag_container(
- int x, int y, boolean do_bb_feedback, callback_object cbo)
- {
- super(x,y,do_bb_feedback,cbo);
- }
-
- //had:
- //* @exception general
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Nearly full constructor. This provides a null callback.
- *
- * @param int x initial x position of the container.
- * @param int y initial y position of the container.
- * @param boolean do_bb_feedback whether we do bounding box feedback.
- */
- public vert_drag_container(int x, int y, boolean do_bb_feedback)
- {
- super(x,y,do_bb_feedback);
- }
-
- //had:
- //* @exception general
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Handle the start of a drag to the object.
- * @param event evt the event "causing" the start of the drag.
- * @param int x_pos x position of new position (in parent's coords).
- * @param int y_pos y position of new position (in parent's coords).
- * @param int grab_x x position where we started the drag (in local
- * coords).
- * @param int grab_y y position where we started the drag (in local
- * coords).
- * @param Object user_info information provided when this object requested
- * focus.
- * @return boolean indicating whether the input was consumed (in this case it
- * always is).
- */
- public boolean drag_start(
- event evt,
- int x_pos, int y_pos,
- int grab_x, int grab_y,
- Object user_info)
- {
- /* modify the move so there is no x component, then let super class go */
- return super.drag_start(evt, x(), y_pos, grab_x, grab_y, user_info);
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Handle a movement during a drag. Here we just set our position to
- * follow the event location and do the move callback.
- *
- * @param event evt the event "causing" the start of the drag.
- * @param int x_pos x position of new position (in parent's coords).
- * @param int y_pos y position of new position (in parent's coords).
- * @param int start_x x position where we started the drag (in parent's
- * coords).
- * @param int start_y y position where we started the drag (in parent's
- * coords).
- * @param int grab_x x position where we started the grab (in local
- * coords).
- * @param int grab_y y position where we started the grab (in local
- * coords).
- * @param Object user_info information provided when this object requested
- * focus.
- * @return boolean indicating whether the input was consumed (in this case it
- * always is).
- */
- public boolean drag_feedback(
- event evt,
- int x_pos, int y_pos,
- int st_x, int st_y,
- int grab_x, int grab_y,
- Object user_info)
- {
- /* modify the move so there is no y component, then let super class go */
- return super.drag_feedback(evt, x(), y_pos, st_x, st_y, grab_x, grab_y,
- user_info);
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
-
- /**
- * Handle input corresponding to the end of a drag.
- *
- * @param event evt the event "causing" the start of the drag.
- * @param int x_pos x position of new position (in parent's coords).
- * @param int y_pos y position of new position (in parent's coords).
- * @param int start_x x position where we started the drag (in parent's
- * coords).
- * @param int start_y y position where we started the drag (in parent's
- * coords).
- * @param int grab_x x position where we started the grab (in local
- * coords).
- * @param int grab_y y position where we started the grab (in local
- * coords).
- * @param Object user_info information provided when this object requested
- * focus.
- * @return boolean indicating whether the input was consumed (in this case it
- * always is).
- */
- public boolean drag_end(
- event evt,
- int x_pos, int y_pos,
- int st_x, int st_y,
- int grab_x, int grab_y,
- Object user_info)
- {
- /* modify the move so there is no y component, then let super class go */
- return super.drag_end(evt, x(), y_pos, st_x, st_y, grab_x, grab_y,
- user_info);
- }
-
- /* . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . */
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-